package com.example.a2032.db.dao;

import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;

import com.example.a2032.entity.PPGMeasureData;
import com.example.a2032.entity.SleepData;

import java.util.List;

@Dao
public interface SleepDataDao {

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void insert(SleepData sleepData);

    @Query("select * from sleepdata")
    LiveData<List<SleepData>> loadAllSleepData();

    @Query("select * from sleepdata where date between :startTime and :endTime")
    LiveData<List<SleepData>> loadSleepData(String startTime, String endTime);

    @Query("select * from sleepdata where date > :lastUploadDate ORDER BY date DESC")
    List<SleepData> getLastPPGData(String lastUploadDate);
}
